/*
 * TCPSocketSSLSend.h
 *
 *  Created on: 2011-3-6
 *      Author: lionxing
 */

#ifndef TCPSOCKETSSLSEND_H_
#define TCPSOCKETSSLSEND_H_
#include <e32base.h>
#include <es_sock.h>
#include <in_sock.h>
#include <SecureSocket.h> 
#include "TCPSocketTimer.h"

class MObserverSendSSL
{
public:
	virtual void OnSendSSL(const TDesC8& aMsg, TInt aError) = 0;
};

class CTCPSocketSSLSender : public CActive, public CTCPSocketTimer::MTimerObserver
{


public:
	static CTCPSocketSSLSender* NewL(MObserverSendSSL& aObserver, CSecureSocket* aSocket);
	// C++ constructor
	CTCPSocketSSLSender(MObserverSendSSL& aObserver, CSecureSocket* aSocket);
	void ConstructL();
	// Cancel and destroy
	~CTCPSocketSSLSender();


private: // From CActive
	// Handle completion
	void RunL();
	
	// How to cancel me
	void DoCancel();

protected: // Functions from CTcpSocketTimer::MTimerObserver
	void OnTimerL(TInt aError);	


private: // member variables
	MObserverSendSSL& iObserver;
	CSecureSocket* iSSLSend;
	HBufC8* iBufferPtr;
	CTCPSocketTimer* iTimer;

public: // New functions
	void Send(const TDesC8& aMsg);

};

#endif /* TCPSOCKETSSLSEND_H_ */
